package com.qiangqiang.task.server.controller;

import com.qiangqiang.task.server.entity.Comments;
import com.qiangqiang.task.server.entity.Moments;
import com.qiangqiang.task.server.service.CommentsService;
import com.qiangqiang.task.server.service.MomentsService;
import com.qiangqiang.task.server.util.ResultVOUtil;
import com.qiangqiang.task.server.vo.ResultVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2019-01-05 21:06
 **/
@RestController
@RequestMapping(value = "/moments")
public class MomentsController {
    @Autowired
    MomentsService momentsService;

    @PostMapping("/addMoments")
    public ResultVO addMoments(Moments moments) {
        return ResultVOUtil.success(momentsService.addMoments(moments));
    }

    @GetMapping("/findAllMomentsByUserId")
    public ResultVO findAllMomentsByUserId(@Param("page") int page, @Param("pageSize") int pageSize,
                                           @Param("userId") long userId) {
        return ResultVOUtil.success(momentsService.findAllMomentsByUserId(page, pageSize, userId));
    }
}
